03. Unit Testing

JAVA C2 L8 03 Unit Testing

We will first look at unit testing REST APIs using JUnit, Mockito and Spring Test (also known as, MockMVC).

  • JUnit is a popular unit testing framework that allows you to test individual units of source code.
  • Mockito is a great mocking framework which provices data for JUnit tests.
  • @MockBean works well with the Mockito library.
  • @WebMvcTest is used for controller layer unit testing.

Which component does the @WebMvcTest annotation test?

SOLUTION: Controller